package com.outsider.note.task;

import java.util.Date;
import java.util.TimerTask;

import org.apache.log4j.Logger;
import org.eclipse.jetty.util.log.Log;

import com.jfinal.kit.PropKit;
import com.jfinal.weixin.sdk.api.AccessToken;
import com.jfinal.weixin.sdk.api.AccessTokenApi;
import com.jfinal.weixin.sdk.api.ApiResult;
import com.jfinal.weixin.sdk.api.CustomServiceApi;
import com.outsider.note.entity.BaseNote;

public abstract class NoteTimerTask extends TimerTask implements Comparable<NoteTimerTask>{
    protected BaseNote note;
	
	public NoteTimerTask(BaseNote note) {
		this.note=note;
	}
	@Override
	public void run(){
		Logger.getLogger("").info("use AccessToken "+AccessTokenApi.getAccessTokenStr()+" "+AccessTokenApi.getAccessToken().getExpiredTime());
	}
	
	public abstract Date getCallDate();
	@Override
	public int compareTo(NoteTimerTask o) {
		if (this.getCallDate().before(o.getCallDate())) return Integer.compare(1, 2);
		else return Integer.compare(2, 1);
	}
	public BaseNote getNote() {
		return note;
	}
	
	

}
